package ch.ffhs.bscinf2009.organizeanything.data;

import java.util.Arrays;
import java.util.List;
@SuppressWarnings({ "javadoc", "serial" })
/**
 * @author lir
 * See AbstractType for javadoc
 */
public class ValueChooserType extends AbstractType {

	private String data;
	private String possibleData;

	@Override
	public String displayValue() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	public String getData() {
		return data;
	}

	public void parseTypeDefinition(String possibleData) {
		if (possibleData == null || !possibleData.contains(";")) {
			throw new IllegalArgumentException(
					"the possible datas need to be separated by semicolons");
		}
		this.possibleData = possibleData;
	}

	public List<String> getPossibleData() {
		return Arrays.asList(possibleData.split(";"));
	}

	@Override
	public String buildTypeDefinition() {
		return possibleData;
	}

}
